package com.book_management.controller;

import com.book_management.component.ErrorCode;
import com.book_management.entity.SysUser;
import com.book_management.exception.ExceptionCast;
import com.book_management.response.BaseResponse;
import com.book_management.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xiangqian
 * @date 2022/12/3 14:02
 * @description:
 */

@RestController
@RequestMapping("/User")
@Api(value = "用户接口")
public class SysUserController {

    private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionCast.class);

    @Autowired
    private SysUserService sysUserService;

    @ApiOperation("用户注册")
    @PostMapping("/register")
    public BaseResponse register(@RequestBody SysUser sysUser){
        sysUserService.insertSysUser(sysUser);
        return new BaseResponse(ErrorCode.RegisterSuccess);

    }

    @ApiOperation("用户登录")
    @PostMapping("/login")
    public BaseResponse login(@RequestBody SysUser sysUser){
        return null;
    }
}
